package org.asociacion.backend.persistence.entities;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

@Entity
@Table(name = "tbl_city", schema="asociacion")
public class TblCity {

	@Id
	@Column
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;

	@Column(name = "name", length = 80, nullable = false)
	private String name;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "tbl_state_id", nullable = false)
	private TblState tblState;
	
	@OneToMany(fetch=FetchType.LAZY, mappedBy="tblCity")
	@OrderBy("firstName")
	private Set<TblUser> setTblUser;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public TblState getTblState() {
		return tblState;
	}

	public void setTblState(TblState tblState) {
		this.tblState = tblState;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<TblUser> getSetTblUser() {
		return setTblUser;
	}

	public void setSetTblUser(Set<TblUser> setTblUser) {
		this.setTblUser = setTblUser;
	}

}
